{% extends 'base.html' %}

{% block content %}
  <h4>{% if form.instance.pk %}编辑荣誉类型{% else %}添加荣誉类型{% endif %}</h4>
  <form method="post">
    {% csrf_token %}
    {% load widget_tweaks %}
    <div class="container mt-4">
      <div class="row justify-content-center">
        <div class="col-md-6">
          <div class="card">
            <div class="card-body">
              {% for field in form %}
                <div class="mb-3">
                  {{ field.label_tag }}
                  {% render_field field class="form-control" %}
                  {% if field.errors %}
                    <div class="invalid-feedback d-block">{{ field.errors|join:', ' }}</div>
                  {% endif %}
                </div>
              {% endfor %}
              <div class="d-flex gap-2">
                <button type="submit" class="btn btn-primary">保存</button>
                <a href="{% url 'core:honor_type_list' %}" class="btn btn-secondary">取消</a>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </form>
{% endblock %}